package com.atde._05_behavioral_design_patterns.observer.improve;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.observer.improve
 * @Author: Del
 * @CreateTime: 2025-06-29  20:04
 * @Description: 观察者模式：当前天气展示类，作为观察者接收并展示天气数据（温度、气压、湿度）
 * @Version: 1.0
 */
public class CurrentConditions implements Observer{
    // 温度, 气压, 湿度
    private float temperature;
    private float presure;
    private float humidity;

    public void update(float temperature, float presure, float humidity) {
        this.temperature = temperature;
        this.presure = presure;
        this.humidity = humidity;
        display();
    }

    public void display() {
        System.out.println("***现在温度是: " + temperature + "***");
        System.out.println("***现在气压是: " + presure + "***");
        System.out.println("***现在湿度是: " + humidity + "***");
    }
}
